using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveLeft : MonoBehaviour
{
    private PlayerController playerController;
    public float speed = 15f;
    // Start is called before the first frame update
    void Start()
    {
        playerController=GameObject.Find("Player").GetComponent<PlayerController>();
    }

    // Update is called once per frame
    void Update()
    {
        if(playerController.gameOver != true)
        {
            transform.Translate(Vector3.left * Time.deltaTime * speed);
            if (transform.position.x < -10f && this.CompareTag("Obstacle"))
            {
                Destroy(gameObject);
            }
        }
       
    }
}
